package com.base.controller;

import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import com.base.po.voip.TaskList;
import com.base.service.TaskListService;

/**
 * 每日任务信息服务端
 * 
 * @author f
 * 
 */
@Controller
@RequestMapping("/admin")
public class index_TaskList {

	@Autowired
	private TaskListService taskListService; // 每日任务信息

	// WEB端进入每日任务页面
	@RequestMapping(value = "/taskListIndex")
	public ModelAndView taskListIndex(HttpServletRequest request) {
		String userid = (String) request.getSession().getAttribute("adminUserId"); // 登录的用户ID
		if (userid == null) return new ModelAndView("jsp/loginCheck"); // 未登录
		return new ModelAndView("jsp/index_TaskList", "taskList", taskListService.selectByAll(new TaskList(userid)));
	}

	// 跳转添加每日任务
	@RequestMapping("/addTaskList")
	public String addTaskList() throws Exception {
		return "jsp/add_TaskList";
	}

	// 跳转修改每日任务
	@RequestMapping("/updateTaskList")
	public ModelAndView updateTaskList(String id) throws Exception {
		return new ModelAndView("jsp/update_TaskList", "tal", taskListService.selectByPrimaryKey(id));
	}
}
